package com.ctsims.system.service.impl;

import java.util.List;
import com.ctsims.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ctsims.system.mapper.CtsCourseMapper;
import com.ctsims.system.domain.CtsCourse;
import com.ctsims.system.service.ICtsCourseService;

/**
 * 课程Service业务层处理
 *
 * @author hhz
 * @date 2023-04-01
 */
@Service
public class CtsCourseServiceImpl implements ICtsCourseService
{
    @Autowired
    private CtsCourseMapper ctsCourseMapper;

    /**
     * 查询课程
     *
     * @param courseId 课程主键
     * @return 课程
     */
    @Override
    public CtsCourse selectCtsCourseByCourseId(Long courseId)
    {
        return ctsCourseMapper.selectCtsCourseByCourseId(courseId);
    }

    /**
     * 查询课程列表
     *
     * @param ctsCourse 课程
     * @return 课程
     */
    @Override
    public List<CtsCourse> selectCtsCourseList(CtsCourse ctsCourse)
    {
        return ctsCourseMapper.selectCtsCourseList(ctsCourse);
    }

    /**
     * 新增课程
     *
     * @param ctsCourse 课程
     * @return 结果
     */
    @Override
    public int insertCtsCourse(CtsCourse ctsCourse)
    {

        ctsCourse.setCreateTime(DateUtils.getNowDate());
        return ctsCourseMapper.insertCtsCourse(ctsCourse);
    }

    /**
     * 修改课程
     *
     * @param ctsCourse 课程
     * @return 结果
     */
    @Override
    public int updateCtsCourse(CtsCourse ctsCourse)
    {
        ctsCourse.setUpdateTime(DateUtils.getNowDate());
        return ctsCourseMapper.updateCtsCourse(ctsCourse);
    }

    /**
     * 批量删除课程
     *
     * @param courseIds 需要删除的课程主键
     * @return 结果
     */
    @Override
    public int deleteCtsCourseByCourseIds(Long[] courseIds)
    {
        return ctsCourseMapper.deleteCtsCourseByCourseIds(courseIds);
    }

    /**
     * 删除课程信息
     *
     * @param courseId 课程主键
     * @return 结果
     */
    @Override
    public int deleteCtsCourseByCourseId(Long courseId)
    {
        return ctsCourseMapper.deleteCtsCourseByCourseId(courseId);
    }
}
